package windows;

import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.WindowConstants;

import coordinators.Cordinator;

public class ManageInsumos extends JFrame 
{
	Cordinator coordinator;
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private ManageInsumosCreate manageInsumosCreate;
	private ManageInsumosModify manageInsumosModify;
	private ManageInsumosDelete manageInsumosDelete;
	private ManageInsumosShow	manageInsumosShow;
	
	private JTabbedPane paneles;

	public ManageInsumos(WindowPrincipal superior)
	{
		super();
		setLayout(null);
		setSize(480,550);

		paneles=new JTabbedPane();
		paneles.setBounds(0,0,getWidth(),getHeight());

		manageInsumosCreate=new ManageInsumosCreate();
		manageInsumosCreate.setBounds(0,0,getWidth(),getHeight());
		manageInsumosCreate.setPreferredSize(manageInsumosCreate.getSize());

		manageInsumosModify =new ManageInsumosModify();
		manageInsumosModify .setBounds(0,0,getWidth(),getHeight());

		manageInsumosDelete=new ManageInsumosDelete();
		manageInsumosDelete.setBounds(0,0,getWidth(),getHeight());

		manageInsumosShow=new ManageInsumosShow();
		manageInsumosShow.setBounds(0,0,getWidth(),getHeight());

		paneles.addTab("Crear Insumos",manageInsumosCreate);
		paneles.addTab("Modificar Insumos", manageInsumosModify);
		paneles.addTab("Eliminar Insumos", manageInsumosDelete);
		paneles.addTab("Mostrar Insumos", manageInsumosShow);

		getContentPane().add(paneles);
		setTitle("Gestionar Insumos");
		setLocation(250, 100);
		setResizable(false);
		
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		this.addWindowListener(new WindowListener() 
		{
	        public void windowClosed(WindowEvent arg0) 
	        {
	        	manageInsumosCreate.clean();
	        	/*manageInsumosDelete.clean();
	        	manageInsumosModify.clean();
	        	manageInsumosShow.clean();*/
	            coordinator.ProcessCloseManageInsumos();
	        }
	        public void windowClosing(WindowEvent arg0) 
	        {
	        }
			public void windowActivated(WindowEvent e) 
			{
			}
			public void windowDeactivated(WindowEvent e) 
			{
			}
			public void windowDeiconified(WindowEvent e) 
			{
			}
			public void windowIconified(WindowEvent e) 
			{
			}
			public void windowOpened(WindowEvent e) 
			{
			}
		});
	}

	public void setCoordinador(Cordinator c)
	{
		coordinator = c;

	}

	
}
